import { resgetCategory,resgetBanner,resgetFloor } from "@/api";
const actions={
    async getcategory({commit}){
        let result = await resgetCategory();
        if(result.code==200){
            commit('GETCATEGORY',result.data)
        }
    },
    // 获取banner数据
    async getbanner({commit}){
        let result = await resgetBanner();
        if(result.code==200){
            commit('GETBANNER',result.data)
        }
    },
    // 获取floor数据
    async getfloor({commit}){
        let result = await resgetFloor();
        console.log(result);
        if(result.code==200){
            commit('GETFLOOR',result.data)
        }
    }
} 
const mutations={
    GETCATEGORY(state,categoryList){
        state.categoryList=categoryList;
    },
    GETBANNER(state,bannerList){
        state.bannerList=bannerList;
    },
    GETFLOOR(state,floorList){
        state.floorList=floorList;
    }
}
const getters={

}
const state={
    categoryList:[],
    floorList:[],
    bannerList:[]

}
export default {
    actions,
    mutations,
    getters,
    state
}